package chapter7.quarter2;

import java.io.*;

public class ObjectRecov implements Serializable {
    public static void main(String[] args) {
        try {
            FileInputStream fi=new FileInputStream("data.ser");
            ObjectInputStream si=new ObjectInputStream(fi);

            Student stu=(Student)si.readObject();
            si.close();
            fi.close();

            System.out.println("id:"+stu.id+",name:"+stu.name+",age:"+stu.age+",department:"+ stu.department);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
